﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter02
{
    public class ArrayType : ICodeListing
    {
        public string StatementArray { get; set; }

        public string InstantiateArray { get; set; }

        public void CodeListing()
        {
            StatementArray();
            TwoDimensionalArray();
            StatementAndAssignmentArray();
            AfterStatementSoAssignmentArray();
        }

        private void StatementArray()
        {
            string[] languages = new string[] { "1", "a", "`" };
            Console.WriteLine(languages);
        }

        private void TwoDimensionalArray()
        {
            int[,] cells = new int[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
            Console.WriteLine(cells);
        }

        private void StatementAndAssignmentArray()
        {
            string[] languages = { "C#", "COBOL", "Java", "C++", "Visual Basic", "Pascal", "fortran", "Lisp", "J#" };
            Console.WriteLine(languages);
        }

        private void AfterStatementSoAssignmentArray()
        {
            string[] languages;
            languages = new string[] { "C#", "COBOL", "Java", "C++", "Visual Basic", "Pascal", "fortran", "Lisp", "J#" };
            Console.WriteLine(languages);
        }

        private void StatementingUseNewAssignmentArray()
        {
            string[] languages = new string[] { "C#", "COBOL", "Java", "C++", "Visual Basic", "Pascal", "fortran", "Lisp", "J#" };
            Console.WriteLine(languages);
        }

        private void StatementingUseNewAssignmentArray2()
        {
            string[] languages = new string[9] { "C#", "COBOL", "Java", "C++", "Visual Basic", "Pascal", "fortran", "Lisp", "J#" };
            Console.WriteLine(languages);
        }

        private void AssignmentArrayButNotInit()
        {
            string[] languages = new string[9];
        }
    }
}
